<template>
  <div>
    <!--    <el-button type="warning" icon="el-icon-star-off" @click="test011" circle></el-button>-->
    <!--    <el-button type="danger" icon="el-icon-delete" @click="test012" circle></el-button>-->
    <el-switch
      v-model="shouldMergePersonInfo"
      active-color="#13ce66"
      inactive-color="#ff4949"
      @click="test013">
    </el-switch>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="date"
        label="日期"
        width="150">
      </el-table-column>
      <el-table-column
        v-if="shouldMergePersonInfo"
        :colspan="2"
        label="人员信息">

        <el-table-column
          prop="name"
          label="姓名"
          width="120">
        </el-table-column>
        <el-table-column
          prop="phone"
          label="电话"
          width="150">
        </el-table-column>

      </el-table-column>

      <el-table-column label="地址">
        <el-table-column
          prop="province"
          label="省份"
          width="120">
        </el-table-column>
        <el-table-column
          prop="city"
          label="市区"
          width="120">
        </el-table-column>
        <el-table-column
          prop="address"
          label="地址"
          width="300">
        </el-table-column>
        <el-table-column
          prop="zip"
          label="邮编"
          width="120">
        </el-table-column>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: "HeadMerging",
  data() {
    return {
      shouldMergePersonInfo: true,
      mergeCount: 2,
      tableData: [{
        date: '2016-05-03',
        name: '张三',
        phone: '18360006001',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1518 弄',
        zip: 200333
      }, {
        date: '2016-05-02',
        name: '李四',
        phone: '18360006002',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1518 弄',
        zip: 200333
      }, {
        date: '2016-05-04',
        name: '赵五',
        phone: '18360006003',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1518 弄',
        zip: 200333
      }]
    }
  },
  methods: {

    test011() {
      // this.$router.push("/app")
      this.shouldMergePersonInfo = true;
    },
    test012() {
      // this.$router.push("/app")
      this.shouldMergePersonInfo = false;
    },
    test013() {
      console.log("测试123--->" + this.shouldMergePersonInfo);
    }

  }
}
</script>
